/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.perficient.ibuzz.ui;

import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.Window;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Trainning
 */
public class TrayIconMouseListener implements MouseListener{

    private Window window;
    private TrayIcon icon;

    public TrayIconMouseListener(Window window, TrayIcon icon) {
        this.window = window;
        this.icon = icon;
    }

    @Override
    public void mouseClicked(MouseEvent e) {
        if(e.getClickCount() == 2) {
            SystemTray tray = SystemTray.getSystemTray();
            BuzzTrayIcon buzzTrayIcon = (BuzzTrayIcon) icon;
            buzzTrayIcon.setIsEndable(true);
            tray.remove(icon);
            window.setVisible(true);
        }
    }

    @Override
    public void mousePressed(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void mouseReleased(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void mouseEntered(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void mouseExited(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

}
